#ifndef PICTURERECEIVER_H
#define PICTURERECEIVER_H

#include <QLabel>
#include <QWidget>



class PictureReceiver : public QWidget
{
    Q_OBJECT
public:
    explicit PictureReceiver(QWidget *parent = nullptr);
    //以下是实现最短路径的算法
    bool spfa(int start,int f);
    bool Johnson();
    void findThepath(int pre[],int s,int f);
    QString createThePath(int pre[],int length);

signals:
public slots:
    void insultPicture();//图片插入函数
    void clearPicture();//图片清除函数
    void insultPoint();//插入点
    void clearPoint();//删除点
    void connectLine();//连接直线
    void clearLine();//清除直线
    void showWeight();// 显示权
    void setWeight();//设置权重
    void setStartAndFinal();
    void showShortestPath();
    void changeMode();
    void paintEvent(QPaintEvent *event)override;
    void mousePressEvent(QMouseEvent *event)override;

private:
    QString fileName;//用于选取图片存储地址
    QPixmap pic;
    int line1[2];// 记录被链接的两个点
    int line2[2];
    int line3[2];
    int line4[2];
    int stateSWP = 0;//用于储存是否绘制权重
};

#endif // PICTURERECEIVER_H
